import cv2
filename = r'F:\lenna.png'
sourceimg = cv2.imread(filename)
grayimg = cv2.cvtColor(sourceimg,cv2.COLOR_BGR2GRAY)
gauss = cv2.GaussianBlur(grayimg, (3,3),0)
sobel = cv2.Sobel(grayimg, -1, 1,1 , ksize=3)# dx=1 ：x方向的偏导若src.depth() = CV_8U, 取ddepth =-1/CV_16S/CV_32F/CV_64F
cv2.imshow('sobel', sobel)

laplace = cv2.Laplacian(gauss, -1, ksize=3)
cv2.imshow('laplace', laplace)

canny = cv2.Canny(gauss,100 ,50)
cv2.imshow('canny', canny)
cv2.waitKey(0)